#include "stdafx.h"
#include "LitEditorFileDialog.h"

namespace Lit
{
	namespace Editor
	{
		FileDialog::FileDialog(void)
		{
		}


		FileDialog::~FileDialog(void)
		{
		}
		
		FilePath FileDialog::getOpenFileName( Instance * inst, const std::string &title, const FilePath& baseDir, const std::string &filters ){
			return FROM_QT( QFileDialog::getOpenFileName( (QWidget*)(inst?inst->getMainWindow():NULL), TO_QT(title), TO_QT(baseDir.str()), TO_QT(filters) ));
		}
		std::vector<FilePath> FileDialog::getOpenFileNames( Instance * inst, const std::string &title, const FilePath& baseDir, const std::string &filters ){
			QStringList lst(QFileDialog::getOpenFileNames((QWidget*)(inst?inst->getMainWindow():NULL), TO_QT(title), TO_QT(baseDir.str()), TO_QT(filters)));
			std::vector<FilePath> ret;
			if( lst.empty() ) return ret;
			for( auto i=lst.begin(); i!=lst.end(); i++ )
				ret.push_back( FROM_QT(*i) );
			return ret;
		}
		FilePath FileDialog::getSaveFileName( Instance * inst, const std::string &title, const FilePath& baseDir, const std::string &filters ){
			return FROM_QT( QFileDialog::getSaveFileName( (QWidget*)(inst?inst->getMainWindow():NULL), TO_QT(title), TO_QT(baseDir.str()), TO_QT(filters) ));
		}
	};
};